﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DbfDotNet2
{
    class Program
    {
        static void Main(string[] args)
        {
            System.IO.Stream fromfile = new System.IO.FileStream("c:\\a.ndx", System.IO.FileMode.Create);
            int keyLength = 20;
            int nodeSize = (4096 - 8) / (keyLength + 8);
            long startSeek = 0;
            var cultureId = System.Globalization.CultureInfo.InvariantCulture.LCID;
            //InitializeInStream
            var tree = BplusDotNet.BplusTreeLong.InitializeInStream(fromfile, keyLength, nodeSize, cultureId, startSeek);

            for (int i = 0; i < 1000000; i++)
            {
                tree.Set("abc"+i, (long)i);
            }
            string key = tree.FirstKey();
            while (key != null)
            {
                long value = tree.Get(key, 0L);
                Console.WriteLine(key + ":" + value);
                key = tree.NextKey(key);

            }

        }
    }
}
